<link rel="stylesheet" href="__PUBLIC__/AdminLTE/plugins/lightbox2/dist/css/lightbox.min.css">
<div class="content-wrapper">
    <section class="content-header">
        <h1>上传发票合同</h1>
        <ol class="breadcrumb">
            <li><a href="/admin"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li class="active">发票管理</li>
            <li class="active"><a href="/admin/OrderBill/orderBillList">发票合同管理</a></li>
            <li class="active">上传</li>
        </ol>
    </section>
    <section class="content">
        <div class="box">
            <div class="box-header with-border">
            </div>
            <div class="box-body">
                <form class="form-horizontal" role="form" action="javascrip:;" method="post">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="col-md-6">
                                <input type="hidden" name="bill_id" id="bill_id" value="{$billInfo.id}" />
                                <input type="hidden" name="order_id" id="order_id" value="{$billInfo.order_id}" />
                                <input type="hidden" name="admin_id" id="admin_id" value="{$billInfo.admin_id}" />

                                <div class="form-group">
                                    <label for="admin_name" class="col-sm-3 control-label"> 业务员 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="业务员" id="admin_name" name="admin_name" value="{$billInfo.admin_name}" disabled readonly>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="order_rate" class="col-sm-3 control-label"> 订单占比 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="订单占比" id="order_rate" name="order_rate" value="{$billInfo.order_rate}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="bill_no" class="col-sm-3 control-label"> 发票号 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="发票号" id="bill_no" name="bill_no" value="{$billInfo.bill_no}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="item_type" class="col-sm-3 control-label"> 产品类型 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="贴吧运营or文字直播" id="item_type" name="item_type" value="{$billInfo.item_type}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="item_name" class="col-sm-3 control-label"> 客户产品 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="产品名称" id="item_name" name="item_name" value="{$billInfo.item_name}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="protocol_number" class="col-sm-3 control-label"> 协议号 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="协议号" id="protocol_number" name="protocol_number" value="{$billInfo.protocol_number}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="is_filing" class="col-sm-3 control-label"> 合同归档 </label>
                                    <div class="col-sm-8">
                                        <select class="form-control" id="is_filing" name="is_filing">
                                            <option value="0" <if condition="$billInfo.is_filing eq 0 ">selected</if>>未归档</option>
                                            <option value="1" <if condition="$billInfo.is_filing eq 1 ">selected</if>>已归档</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="company_title" class="col-sm-3 control-label">开票公司抬头 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="开票公司抬头" id="company_title" name="company_title" value="{$billInfo.company_title}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="arrival_time" class="col-sm-3 control-label">提前开票到款时间 </label>
                                    <div class="col-sm-8 date">
                                        <input type="text" class="form-control date-time" id="arrival_time" name="arrival_time" value="{$billInfo.arrival_time|date='Y-m-d',###}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="type" class="col-sm-3 control-label">发票类型 </label>
                                    <div class="col-sm-8">
                                        <select class="form-control" id="type" name="type">
                                            <option value="0">请选择</option>
                                            <foreach name="bill_typeList" item="b_val" key="b_key">
                                                <option value="{$b_key}" <if condition="$billInfo.type eq $b_key">selected</if>>{$b_val}</option>
                                            </foreach>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="amount" class="col-sm-3 control-label">开票金额 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="0.00" id="amount" name="amount" value="{$billInfo.amount}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="description" class="col-sm-3 control-label">开票内容 </label>
                                    <div class="col-sm-8">
                                        <textarea type="text" class="form-control" placeholder="开票内容" id="description" name="description" rows="5">{$billInfo.description}</textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="bill_title" class="col-sm-3 control-label">发票抬头 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="发票抬头" id="bill_title" name="bill_title" value="{$billInfo.bill_title}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="send_type" class="col-sm-3 control-label">寄送方式 </label>
                                    <div class="col-sm-8">
                                        <select class="form-control" id="send_type" name="send_type">
                                            <option value="0">请选择</option>
                                            <option value="1" <if condition="$billInfo.send_type eq 1 ">selected</if>>自取</option>
                                            <option value="2" <if condition="$billInfo.send_type eq 2 ">selected</if>>邮寄</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="send_address" class="col-sm-3 control-label">邮寄地址 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="邮寄地址" id="send_address" name="send_address" value="{$billInfo.send_address}">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="taxpayer_id_number" class="col-sm-3 control-label">纳税人识别号 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="纳税人识别号" id="taxpayer_id_number" name="taxpayer_id_number" value="{$billInfo.taxpayer_id_number}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="address" class="col-sm-3 control-label">地址 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="地址" id="address" name="address" value="{$billInfo.address}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="bank" class="col-sm-3 control-label">开户行 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="开户行" id="bank" name="bank" value="{$billInfo.bank}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="bank_account" class="col-sm-3 control-label">银行账号 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="银行账号" id="bank_account" name="bank_account" value="{$billInfo.bank_account}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="mobile" class="col-sm-3 control-label">联系电话 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="联系电话" id="mobile" name="mobile" value="{$billInfo.mobile}">
                                    </div>
                                </div>

                                <!--合同-->
                                <div class="form-group">
                                    <label for="contract" class="col-sm-3 control-label"> 合同： </label>
                                    <div class="col-sm-8 input-group input-group-sm">
                                        <input type="text" class="form-control" id="contract" value="{$billInfo.contract}" disabled readonly>
                                        <span class="input-group-btn">
                                            <input id='upload_contract' name="file_upload" type="button" value='上传' class='btn btn-sm btn-success'>
                                        </span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="mobile" class="col-sm-3 control-label"></label>
                                    <div class="col-sm-8" id="contract-file">
                                        <if condition="substr($billInfo['contract'],strpos($billInfo['contract'],'.')+1) eq 'pdf'">
                                            <a href="__PUBLIC__/{$billInfo.contract}">点击查看</a>
                                            <elseif condition="$billInfo['contract']" />
                                            <img src="__PUBLIC__/{$billInfo.contract}" width="100%">
                                        </if>
                                    </div>
                                </div>
                                <!--合同资质-->
                                <div class="form-group">
                                    <label for="contract_qualification" class="col-sm-3 control-label"> 合同资质： </label>
                                    <div class="col-sm-8 input-group input-group-sm">
                                        <input type="text" class="form-control" id="contract_qualification" value="{$billInfo.contract_qualification}" disabled readonly>
                                        <span class="input-group-btn">
                                            <input id='upload_contract_qualification' name="file_upload" type="button" value='上传' class='btn btn-sm btn-success'>
                                        </span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="mobile" class="col-sm-3 control-label"></label>
                                    <div class="col-sm-8" id="contract_qualification-file">
                                        <if condition="$billInfo['contract_qualification']">
                                            <a href="__PUBLIC__/{$billInfo.contract_qualification}" data-lightbox="image-1">
                                                <img src="__PUBLIC__/{$billInfo.contract_qualification}" width="100%">
                                            </a>
                                        </if>
                                    </div>
                                </div>
                                <!--发票-->
                                <div class="form-group">
                                    <label for="bill" class="col-sm-3 control-label"> 发票： </label>
                                    <div class="col-sm-8 input-group input-group-sm">
                                        <input type="text" class="form-control" id="bill" value="{$billInfo.bill}" disabled readonly>
                                        <span class="input-group-btn">
                                            <input id='upload_bill' name="file_upload" type="button" value='上传' class='btn btn-sm btn-success'>
                                        </span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="mobile" class="col-sm-3 control-label"></label>
                                    <div class="col-sm-8" id="bill-file">
                                        <if condition="substr($billInfo['bill'],strpos($billInfo['bill'],'.')+1) eq 'pdf'">
                                            <a href="__PUBLIC__/{$billInfo.bill}">点击查看</a>
                                            <elseif condition="$billInfo['bill']"/>
                                            <a href="__PUBLIC__/{$billInfo.bill}" data-lightbox="image-1">
                                                <img src="__PUBLIC__/{$billInfo.bill}" width="100%">
                                            </a>
                                        </if>
                                    </div>
                                </div>
                                <!-- 物料 -->
                                <div class="form-group">
                                    <label for="materiel" class="col-sm-3 control-label"> 物料： </label>
                                    <div class="col-sm-8 input-group input-group-sm">
                                        <input type="text" class="form-control" id="materiel" value="{$billInfo.materiel}" disabled readonly>
                                        <span class="input-group-btn">
                                            <input id='upload_materiel' name="file_upload" type="button" value='上传' class='btn btn-sm btn-success'>
                                        </span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="mobile" class="col-sm-3 control-label"></label>
                                    <div class="col-sm-8" id="materiel-file">
                                        <if condition="substr($billInfo['materiel'],strpos($billInfo['materiel'],'.')+1) eq 'pdf'">
                                            <a href="__PUBLIC__/{$billInfo.materiel}">点击查看</a>
                                            <elseif condition="$billInfo['materiel']"/>
                                            <a href="__PUBLIC__/{$billInfo.materiel}" data-lightbox="image-1">
                                                <img src="__PUBLIC__/{$billInfo.materiel}" width="100%">
                                            </a>
                                        </if>
                                    </div>
                                </div>

                                <!--进项-->
                                <div class="form-group">
                                    <label for="receipts_time" class="col-sm-3 control-label">进项登记时间 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control date-time" placeholder="进项登记时间" id="receipts_time" name="receipts_time" value="{$billInfo.receipts_time|date='Y-m-d',###}" readonly/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="receipts_type" class="col-sm-3 control-label">进项开票类型 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="进项开票类型" id="receipts_type" name="receipts_type" value="{$billInfo.receipts_type}"/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="receipts_no" class="col-sm-3 control-label">进项发票号 </label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="进项发票号" id="receipts_no" name="receipts_no" value="{$billInfo.receipts_no|default=''}"/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="receipts_desc" class="col-sm-3 control-label">进项开票内容 </label>
                                    <div class="col-sm-8">
                                        <textarea type="text" class="form-control" placeholder="进项开票内容" id="receipts_desc" name="receipts_desc" rows="4">{$billInfo.receipts_desc}</textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="receipts_remark" class="col-sm-3 control-label">进项开票备注 </label>
                                    <div class="col-sm-8">
                                        <textarea type="text" class="form-control" placeholder="进项开票备注" id="receipts_remark" name="receipts_remark" rows="4">{$billInfo.receipts_remark}</textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="form-field-1" class="col-sm-5 control-label"></label>
                        <div class="col-sm-5">
                            <button type="button" class="btn btn-info btn-sm save-btn">提交</button>
                            &nbsp;
                            <button type="reset" class="btn btn-sm">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </section>
</div>
<script src="__PUBLIC__/global/AjaxUpload.js"></script>
<script src="__PUBLIC__/AdminLTE/plugins/layer/layer.js"></script>
<script src="__PUBLIC__/AdminLTE/plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<script type="application/javascript" src="__PUBLIC__/AdminLTE/plugins/lightbox2/dist/js/lightbox.min.js"></script>
<script type="application/javascript">
    $(function () {
        lightbox.option({
            'resizeDuration': 200,
            'wrapAround': true
        });
        //Date picker
        $('.date-time').datepicker({
            startDate: new Date(),
            language: 'zh-CN',
            format:'yyyy-mm-dd',
            todayHighlight: true,
            autoclose: true
        });
    });

    //保存
    $(".save-btn").click(function(){
        var bill_id = $("#bill_id").val();
        var order_id = $("#order_id").val();
        var admin_id = $("#admin_id").val();
        var order_rate = $("#order_rate").val();
        var company_title = $("#company_title").val();
        var bill_title = $("#bill_title").val();
        var bill_no = $("#bill_no").val();
        var protocol_number = $("#protocol_number").val();
        var is_filing = $("#is_filing").val();
        var type = $("#type").val();
        var item_name = $("#item_name").val();
        var item_type = $("#item_type").val();
        var arrival_time = $("#arrival_time").val();
        var amount = $("#amount").val();
        var description = $("#description").val();
        var send_type = $("#send_type").val();
        var taxpayer_id_number = $("#taxpayer_id_number").val();
        var address = $("#address").val();
        var send_address = $("#send_address").val();
        var bank = $("#bank").val();
        var bank_account = $("#bank_account").val();
        var mobile = $("#mobile").val();

        var bill = $("#bill").val();
        var materiel = $("#materiel").val();
        var contract = $("#contract").val();
        var contract_qualification = $("#contract_qualification").val();

        var receipts_time = $("#receipts_time").val();
        var receipts_type = $.trim($("#receipts_type").val());
        var receipts_no = $.trim($("#receipts_no").val());
        var receipts_desc = $.trim($("#receipts_desc").val());
        var receipts_remark = $.trim($("#receipts_remark").val());

        if(order_rate == '') {
            layer.msg('请填写订单占比',{time: 1000});
            $("#order_rate").focus();
            return false;
        }

        if(company_title == '') {
            layer.msg('请填写开票公司台头',{time: 1000});
            $("#company_title").focus();
            return false;
        }
        if(bill_title == '') {
            layer.msg('请填写发票抬头',{time: 1000});
            $("#bill_title").focus();
            return false;
        }
        if(protocol_number == '') {
            layer.msg('请填写协议号',{time: 1000});
            $("#protocol_number").focus();
            return false;
        }
        if(item_name == '') {
            layer.msg('请填写客户推广产品',{time: 1000});
            $("#item_name").focus();
            return false;
        }
        if(item_type == '') {
            layer.msg('请填写产品类型',{time: 1000});
            $("#item_type").focus();
            return false;
        }
        if(arrival_time == '') {
            layer.msg('请填写预计到账时间',{time: 1000});
            $("#arrival_time").focus();
            return false;
        }
        if(type == '' || type==0) {
            layer.msg('请选择发票类型',{time: 1000});
            $("#type").focus();
            return false;
        }
        if(amount == '') {
            layer.msg('请填写开票金额',{time: 1000});
            $("#amount").focus();
            return false;
        }
        if(description == '') {
            layer.msg('请填写开票内容',{time: 1000});
            $("#description").focus();
            return false;
        }
        if(send_type == '' || send_type==0) {
            layer.msg('请选择寄送方式',{time: 1000});
            $("#send_type").focus();
            return false;
        }
        if(send_type==2 && (send_address=='')){
            layer.msg('请填写地址信息',{time: 1000});
            $("#send_address").focus();
            return false;
        }
        if(type==2 && (taxpayer_id_number == '')) {
            layer.msg('请填写纳税人识别号',{time: 1000});
            $("#taxpayer_id_number").focus();
            return false;
        }
        if(type==2 && (address == '')) {
            layer.msg('请填写地址信息',{time: 1000});
            $("#address").focus();
            return false;
        }
        if(type==2 && (bank == '')) {
            layer.msg('请填写开户行',{time: 1000});
            $("#bank").focus();
            return false;
        }
        if(type==2 && (bank_account == '')) {
            layer.msg('请填写开户行账号',{time: 1000});
            $("#bank_account").focus();
            return false;
        }

        $.post('/admin/OrderBill/doUploadOrderBill',
            {
                bill_id: bill_id,
                order_rate: order_rate,
                admin_id: admin_id,
                order_id: order_id,
                company_title: company_title,
                bill_title: bill_title,
                protocol_number: protocol_number,
                is_filing: is_filing,
                type: type,
                item_name: item_name,
                bill_no: bill_no,
                item_type: item_type,
                arrival_time: arrival_time,
                amount: amount,
                description: description,
                send_type: send_type,
                taxpayer_id_number: taxpayer_id_number,
                address: address,
                send_address: send_address,
                bank: bank,
                bank_account: bank_account,
                mobile: mobile,
                bill: bill,
                contract: contract,
                contract_qualification: contract_qualification,
                materiel: materiel,
                receipts_time: receipts_time,
                receipts_type: receipts_type,
                receipts_no: receipts_no,
                receipts_desc: receipts_desc,
                receipts_remark: receipts_remark
            }, function(data){
                if(data.Code == 999) {
                    layer.alert('操作成功', {
                        skin: 'layui-layer-molv' //样式类名
                        ,closeBtn: 0
                    }, function(){
                        window.location.reload(true);
                    });
                } else {
                    layer.alert(data.Msg, {
                        skin: 'layui-layer-molv' //样式类名
                        ,closeBtn: 0
                    });
                }
            }, 'json');
    });
</script>
<script type="text/javascript">
//异步上传文件
$(function () {
    new AjaxUpload("#upload_bill", {
        action: '/admin/index/ajaxUploadFile',
        type:"POST",
        name:'import',
        data:{doc: 'doc'},
        responseType: 'json',
        onSubmit: function(file, ext) {
            if("jpeg,JPG,png,pdf".indexOf(ext)<0){
                layer.msg("请上传jpeg,JPG,png,pdf格式的文件");
                return false;
            }
            layer.load(1, {
                shade: [0.48,'#999'] //0.1透明度的白色背景
            });
        },
        onComplete: function(file, response) {
            layer.closeAll('loading');
            if(response.Code ==999) {
                var str = "";
                var file =response.Data.file;
                var info =response.Data.info;
                console.info(info);
                layer.msg('上传成功');
                if(info.extension=='pdf'){
                    str = '<a href="__PUBLIC__'+file+'">点击查看</a>';
                }else{
                    str = '<a href="__PUBLIC__'+file+'" data-lightbox="image-1">';
                    str +='<img src="__PUBLIC__'+file+'" width="100%">';
                    str += '</a>';
                }
                $("#bill-file").html(str);
                $("#bill").val(file)
                //window.location.reload(true);
            }else{
                layer.msg(response.Msg);
                return false;
            }
        }
    });
    new AjaxUpload("#upload_contract", {
        action: '/admin/index/ajaxUploadFile',
        type:"POST",
        name:'import',
        data:{doc: 'doc'},
        responseType: 'json',
        onSubmit: function(file, ext) {
            if("jpeg,JPG,png,pdf".indexOf(ext)<0){
                layer.msg("请上传jpeg,JPG,png,pdf格式的文件");
                return false;
            }
            layer.load(1, {
                shade: [0.48,'#999'] //0.1透明度的白色背景
            });
        },
        onComplete: function(file, response) {
            layer.closeAll('loading');
            if(response.Code ==999) {
                var str = "";
                var file =response.Data.file;
                var info =response.Data.info;
                layer.msg('上传成功');
                if(info.extension =='pdf'){
                    str = '<a href="__PUBLIC__'+file+'">点击查看</a>';
                }else{
                    str = '<a href="__PUBLIC__'+file+'" data-lightbox="image-1">';
                    str +='<img src="__PUBLIC__'+file+'" width="100%">';
                    str += '</a>';
                }
                $("#contract-file").html(str);
                $("#contract").val(file)
                //window.location.reload(true);
            }else{
                layer.msg(response.Msg);
                return false;
            }
        }
    });
    new AjaxUpload("#upload_contract_qualification", {
        action: '/admin/index/ajaxUploadFile',
        type:"POST",
        name:'import',
        data:{doc: 'doc'},
        responseType: 'json',
        onSubmit: function(file, ext) {
            if("jpeg,JPG,png".indexOf(ext)<0){
                layer.msg("请上传jpeg,JPG,png格式的文件");
                return false;
            }
            layer.load(1, {
                shade: [0.48,'#999'] //0.1透明度的白色背景
            });
        },
        onComplete: function(file, response) {
            layer.closeAll('loading');
            if(response.Code ==999) {
                var str = "";
                var file =response.Data.file;
                var info =response.Data.info;
                layer.msg('上传成功');
                if(info.extension =='pdf'){
                    str = '<a href="__PUBLIC__'+file+'">点击查看</a>';
                }else{
                    str = '<a href="__PUBLIC__'+file+'" data-lightbox="image-1">';
                    str +='<img src="__PUBLIC__'+file+'" width="100%">';
                    str += '</a>';
                }
                $("#contract_qualification-file").html(str);
                $("#contract_qualification").val(file)
                //window.location.reload(true);
            }else{
                layer.msg(response.Msg);
                return false;
            }
        }
    });
    new AjaxUpload("#upload_materiel", {
        action: '/admin/index/ajaxUploadFile',
        type:"POST",
        name:'import',
        data:{doc: 'doc'},
        responseType: 'json',
        onSubmit: function(file, ext) {
            if("jpeg,JPG,png".indexOf(ext)<0){
                layer.msg("请上传jpeg,JPG,png格式的文件");
                return false;
            }
            layer.load(1, {
                shade: [0.48,'#999'] //0.1透明度的白色背景
            });
        },
        onComplete: function(file, response) {
            layer.closeAll('loading');
            if(response.Code ==999) {
                var str = "";
                var file =response.Data.file;
                var info =response.Data.info;
                layer.msg('上传成功');
                if(info.extension =='pdf'){
                    str = '<a href="__PUBLIC__'+file+'">点击查看</a>';
                }else{
                    str = '<a href="__PUBLIC__'+file+'" data-lightbox="image-1">';
                    str +='<img src="__PUBLIC__'+file+'" width="100%">';
                    str += '</a>';
                }
                $("#materiel-file").html(str);
                $("#materiel").val(file)
                //window.location.reload(true);
            }else{
                layer.msg(response.Msg);
                return false;
            }
        }
    });
});
</script>